﻿<%@ WebHandler Language="C#" Class="Handler" %>

using System;
using System.Web;

public class Handler : IHttpHandler
{

    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "application/octet-stream";

        /*
        string filename = "天 空.doc";
        
        context.Response.AddHeader(
            "Content-Disposition",
            string.Format("attachment; filename={0}", filename)
            );
        */

        string filename = context.Server.UrlPathEncode("天 空.doc");
        context.Response.AddHeader(
            "Content-Disposition",
            string.Format("attachment; filename={0}", filename)
            );

        context.Response.TransmitFile(
            context.Server.MapPath("~/天 空.doc")
            );

    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }

}